package com.my.aslife.utils;

import com.my.aslife.module.common.TypeName;
import org.jetbrains.annotations.NotNull;

/**
 * @author mayuan
 * @description TODO
 */
public class MyCheckUtils {

    private MyCheckUtils(){}


    /**
     * 判断路径是否有 login
     * @param splitRequestPath 截取路径数组
     * @author yuan.ma
     * @return boolean
     */
    public static boolean checkLoginPath(@NotNull String[] splitRequestPath) {
        for (int i = 0; i < splitRequestPath.length; ++i) {
            if (splitRequestPath[i].equals("login") || splitRequestPath[i].equals("register")) {
                return true;
            }
        }
        return false;
    }

    /**
     * 将 type 数字类型转化为 typeName 具体名称
     * @param type 数字类型
     * @author yuan.ma
     * @return typeName 具体名称
     */
    public static String typeToTypeName(Integer type){
        switch (type) {
            case 0:
                return TypeName.TYPE_0.getTypeName();
            case 1:
                return TypeName.TYPE_1.getTypeName();
            case 11:
                return TypeName.TYPE_11.getTypeName();
            case 20:
                return TypeName.TYPE_20.getTypeName();
            case 21:
                return TypeName.TYPE_21.getTypeName();
            case 99:
                return TypeName.TYPE_99.getTypeName();
            default:
                return TypeName.TYPE_10.getTypeName();
        }
    }
}